package com.example.mountainwalker.mapper;

import com.example.mountainwalker.entity.ScenicCommentInfo;
import com.example.mountainwalker.entity.ScenicFavoriteInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ScenicFavoriteMapper {
    @Select("SELECT * FROM scenicfavorite WHERE UserID = #{id}")
    ScenicFavoriteInfo getScenicFavoriteInfoById(Integer id);

    @Select("SELECT * FROM scenicfavorite")
    List<ScenicFavoriteInfo> getScenicFavoriteInfo();

    @Delete("DELETE FROM scenicfavorite WHERE UserID = #{id}")
    int deleteScenicFavoriteInfoById(Integer id);

    @Update("UPDATE scenicfavorite SET " +
            "UserID = #{userID}, " +
            "ScenicSpotID = #{scenicSpotID} " +
            "WHERE ScenicFavoriteID = #{scenicFavoriteID}" )
    int updateScenicFavoriteInfo(ScenicFavoriteInfo scenicFavoriteInfo);

}
